//
//  YLProgressMoneyBaseView.m
//  YLFinanceService
//
//  Created by she1323 on 2017/9/13.
//  Copyright © 2017年 she1323. All rights reserved.
//

#import "YLProgressMoneyBaseView.h"
#import <Masonry.h>
#import "YLGlobeHeader.h"
#import "YLProgressHeaderModel.h"

@interface YLProgressMoneyBaseView ()
@property (nonatomic, weak) UILabel *titleLabel;
@property (nonatomic, weak) UILabel *contentLabel;
@property (nonatomic, weak) UIView *circle;
@end

@implementation YLProgressMoneyBaseView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setUpUI];
    }
    return self;
}

+ (instancetype)baseView
{
    return [[self alloc] initWithFrame:CGRectZero];
}

- (void)setModel:(YLProgressHeaderModel *)model
{
    _model = model;
    _circle.backgroundColor = model.circleColor;
    _titleLabel.text = model.title;
    _contentLabel.text = model.content;
    
}

- (void)setUpUI
{
    __weak typeof(self) weakSelf = self;
    UILabel *titlelabel = [[UILabel alloc] init];
    _titleLabel = titlelabel;
    titlelabel.font = [UIFont systemFontOfSize:13.0f];
    titlelabel.textColor = YLLineColor;
    [weakSelf addSubview:titlelabel];
    [titlelabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(weakSelf).mas_offset(10);
        make.top.mas_equalTo(weakSelf).mas_offset(5);
    }];
    
    UIView *circle = [[UIView alloc] init];
    circle.backgroundColor = [UIColor redColor];
    _circle = circle;
    circle.layer.masksToBounds = YES;
    circle.layer.cornerRadius = 3;
    [weakSelf addSubview:circle];
    [circle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(titlelabel);
        make.left.mas_equalTo(weakSelf);
        make.width.height.mas_equalTo(6);
    }];
    
    UILabel *contentLabel = [[UILabel alloc] init];
    _contentLabel = contentLabel;
    contentLabel.font = [UIFont systemFontOfSize:13.0f];
    contentLabel.textColor = YLLineColor;
    [weakSelf addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(weakSelf);
        make.top.mas_equalTo(titlelabel.mas_bottom).mas_offset(5);
        make.bottom.mas_equalTo(weakSelf);
    }];
}

@end
